<template>
	<view class="">
		<Header title="修改日志" :showBack="true"></Header>
		<view class="box" v-if="list.length>0">
			<view class="list">
				<block v-for="(item,index) in list" :key="index">
					<view class="item">
						<!-- <view class="time">{{item.creationTime}}</view>
						<view class="describe">{{item.typeFlag==1?'牛奶':'其他'}}限购次数由 <text class="margin-l-r red">{{item.oldValue}}</text> 次 修改成 <text class="margin-l-r green">{{item.newValue}}</text> 次</view> -->
						<view class="line-box">
							<view class="type title">{{item.typeFlag==1?'牛奶':'其他'}}限购</view>
							<view class="value-show time">{{item.creationTime}}</view>
						</view>
						<view class="line-box">
							<view class="type text-rt">修改前：<text class="margin-l-r red">{{item.oldValue || '--'}}</text>次</view>
							<view class="value-show text-rt">修改后：<text class="margin-l-r green">{{item.newValue || '--'}}</text>次</view>
						</view>
					</view>
				</block>
			</view>
		</view>
		<view class="empty-box" v-else>
			<view class="quesheng">
				<image class="empty" src="../../static/icon/icon_empty.jpg" mode=""></image>
				<view class="empty-txt">暂无数据</view>
			</view>
		</view>
		
	</view>
</template>

<script>
export default {
	data() {
		return {
			list: []
		};
	},
	onLoad() {
		this.getList(uni.getStorageSync('info').id);
	},
	methods: {
		getList(id) {
			let data = {
				condition: {
					memberCardId: id
				}
			};
			this.$http(`/member/api/memberCard/getMemberCardChangeRecordList`, data, res=>{
				this.list = res.data.items.map(item=>({...item,newValue: item.newValue == '-1'?'0': item.newValue,oldValue:item.oldValue == '-1'?'0': item.oldValue}))
			});
		}
	}
};
</script>

<style lang="less">
	.box{
		background: #fff;
		box-shadow: 0 0 10rpx 10rpx rgba(0, 0, 0, .05);
		margin: 20rpx;
		border-radius: 16rpx;
		padding: 20rpx
	}
	.list{
		.item{
			height: 136rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;
			font-size: 24rpx;
			.line-box{
				.type{ margin-bottom: 18rpx; }
				.title{
					font-size: 28rpx;
				}
			}
		}
	}
	.margin-l-r{ width: 46rpx;text-align: center; margin: 0 10rpx; font-weight: bold; font-size: 30rpx; display: inline-block; }
	.red{ color: #e44032 }
	.green{ color: #259445 }
	.text-rt{ text-align: right; }
	.time{ color: #7d7d7d; }
	
	.empty-box{
		display: flex;
		flex-direction: column;
		justify-content: center;
		flex: 1;
		height: 80vh;
		background: #fff;
		box-shadow: 0 0 10rpx 10rpx rgba(0, 0, 0, .05);
		margin: 20rpx;
		border-radius: 16rpx;
		padding: 20rpx
	}
	.quesheng{
		color: #b3b3b3;
		width: 100%;
		text-align: center;
		margin: 200upx auto;
		display: flex;
		flex-direction: column;
		align-items: center;
	}
	.quesheng .empty{
		width: 180upx;
		height: 150upx;
		margin-bottom: 34upx;
	}
	.quesheng .empty-txt{
		font-size: 28upx;
		/* margin-bottom: 220upx; */
	}
</style>
